<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page language="java" import="java.util.*" %>
<jsp:directive.page import="com.xr.common.CommUtil"/>
<jsp:directive.page import="com.bstek.dorado.data.db.*"/>
<jsp:directive.page import="com.bstek.dorado.utils.variant.VariantSet"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
<script language="javascript" src="<%=request.getContextPath()%>/dorado/smartweb2.loadUserLib.d?file=/lib/jquery1.8.2.min.js"></script>
 <script  src="<%=request.getContextPath()%>/dorado/smartweb2.loadUserLib.d?file=/lib/highcharts2.3.5.js"></script>
<script   src="<%=request.getContextPath()%>/dorado/smartweb2.loadUserLib.d?file=/lib/exporting2.3.5.js"></script>
<script type="text/javascript"> 
		 	<%
		int cmc=0;
		String cfc="",c="",xl="";
		int sum=0;
		String comId=request.getParameter("comId");
			DBStatement dbs=new  DBStatement();
			dbs.setSql("select count(1) from org_employee emp,org_onoff_station oos where oos.employee_id=emp.employee_id and oos.status=2 and exists (select 1 from org_company com where com.dr=0 and oos.company_id=com.company_id  start with com.company_id="+comId+" CONNECT BY prior  com.company_id=com.super_company_id)");
			VariantSet vs1=dbs.query();
			sum=vs1.getInt(0);
			dbs.setSql("select count(1), nvl(emp.MARRIAGE_STATUS,0) MARRIAGE_STATUS from org_employee emp,org_onoff_station oos where oos.employee_id=emp.employee_id and oos.status=2 and exists (select 1 from org_company com where com.dr=0 and oos.company_id=com.company_id  start with com.company_id="+comId+" CONNECT BY prior  com.company_id=com.super_company_id)  group by  nvl(emp.MARRIAGE_STATUS,0) order by  nvl(emp.MARRIAGE_STATUS,0)");
			List list=dbs.queryForList();
			if(list.size()==0){out.write("</script><body>该公司无数据被统计！<body>"); return;}
			for(int i=0;i<list.size();i++){
			  VariantSet vs=(VariantSet)list.get(i);
			    
			  if(vs.getString("MARRIAGE_STATUS")==null||vs.getString("MARRIAGE_STATUS").equals("0"))xl="未设置";
			  else if(vs.getString("MARRIAGE_STATUS").equals("1"))xl="未婚";
			  else if(vs.getString("MARRIAGE_STATUS").equals("2"))xl="已婚";
			  else if(vs.getString("MARRIAGE_STATUS").equals("3"))xl="离异";
			  else if(vs.getString("MARRIAGE_STATUS").equals("4"))xl="丧偶";
			  else if(vs.getString("MARRIAGE_STATUS").equals("5"))xl="其它";
		//	  System.out.println(vs.getInt(0)*100/93);
			   cfc+="['"+xl+"',"+(vs.getInt(0)*100/sum)+"],";
			   
			   
			}
		dbs.close();
			cfc=cfc.substring(0,cfc.length()-1); 
		%>
		
			var chart;
			$(document).ready(function() {
				chart = new Highcharts.Chart({
					chart: {
						renderTo: 'container'
					},
					title: {
						text: ''
					},
					plotArea: {
						shadow: null,
						borderWidth: null,
						backgroundColor: null
					},
					tooltip: {
						formatter: function() {
							return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
						}
					},
					plotOptions: {
						pie: {
							allowPointSelect: true,
							cursor: 'pointer',
							dataLabels: {
								enabled: false
							},
							showInLegend: true
						}
					},
				    series: [{
						type: 'pie',
						name: 'Browser share',
						data: [
							<%=cfc%>
						]
					}]
				});
			});
				
		</script>

  </head>
  
  <body>
  <%
	String yy=CommUtil.functionPrower("jsp/org/orgStatMain.jsp");
		 	if(!yy.equals("")){
		 	  out.println(yy);
		 	  return;
		 	}
 %>
    <div id="container" style="width: 100%; height: 100%; margin: 0 auto"></div>

  </body>
</html>
